"""
作者：元明
日期：2023年10月30日
"""

import multiprocessing as mp
import time


def task1():
    for i in range(10):
        print(mp.current_process(), 'task1 run...')
        time.sleep(0.2)


def task2():
    for i in range(10):
        print(mp.current_process(), 'task2 run...')
        time.sleep(0.2)


def creat_task():
    p1 = mp.Process(target=task1, name='myProcess-1')
    p2 = mp.Process(target=task2)
    p1.start()
    p2.start()
    print("main: ", mp.current_process())


if __name__ == '__main__':
    creat_task()
